<h2 class="subtitle">Settings</h2>

<%= form_for @changeset, Routes.repo_path(@conn, :update, @repo.owner_login, @repo), [as: :repo], fn f -> %>
  <div class="field">
    <%= label f, :name, class: "label" %>
    <div class="control">
      <%= text_input f, :name, class: "input" %>
    </div>
    <%= error_tag f, :name %>
  </div>

  <div class="field">
    <%= label f, :description, class: "label" %>
    <div class="control">
      <%= text_input f, :description, class: "input" %>
    </div>
    <%= error_tag f, :description %>
  </div>

  <div class="field">
    <div class="control">
      <label class="radio">
        <%= radio_button f, :public, true %>
        Public
      </label>
      <label class="radio">
        <%= radio_button f, :public, false %>
        Private
      </label>
    </div>
  </div>

  <hr />

  <div class="field is-grouped">
    <p class="control">
      <%= submit "Update repository", class: "button is-link" %>
    </p>
    <%= if @repo.owner_id == @current_user.id do %>
      <p class="control">
        <%= button "Delete repository", to: Routes.repo_path(@conn, :delete, @repo.owner_login, @repo), method: "delete", class: "button is-danger", data: [confirm: "Once you delete a repository, there is no going back.\nPlease be certain."] %>
      </p>
    <% end %>
  </div>
<% end %>
